#!/bin/sh

dir="${1}"
shift 1

if [ -z "${dir}" ]
then
    1>&2 echo "usage:"
    1>&2 echo "  ${0} <directory> [<option>]"
    exit 1
fi

while true; do subreddit-pics-pages 160 "$dir" | sponge "${dir}.txt" ; sleep 600 ; done

